package main

import (
	"fmt"
	"sync"
	"time"
)

func SendEmail(wg *sync.WaitGroup) {
	// fmt.Println("发送邮件")
	time.Sleep(5 * time.Second)
	wg.Done()
}

func SendMsg(wg *sync.WaitGroup) {
	// fmt.Println("发送短信")
	time.Sleep(5 * time.Second)
	wg.Done()
}

func main() {
	wg := sync.WaitGroup{}
	wg.Add(200000)
	t1 := time.Now()
	for i := 0; i < 100000; i++ {
		go SendEmail(&wg)
		go SendMsg(&wg)
	}
	wg.Wait()
	end_time := time.Since(t1)
	fmt.Println("消耗的时间", end_time)

}
